]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
unlockDialog: Block auth when limit reached
authorIgnacy Kuchciński <ignacykuchcinski@gnome.org>
Tue, 25 Nov 2025 04:48:20 +0000 (05:48 +0100)
committerMarge Bot <marge-bot@gnome.org>
Wed, 14 Jan 2026 14:35:30 +0000 (14:35 +0000)
Block ability to authenticate when screen time limit is reached, so
that the child cannot unlock.

Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/work_items/8577
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3980>

js/ui/unlockDialog.js

index 676a2fe8ba103d877d6dbdbb639513379fbc139a..c151222b4675c014e5643a9cdb759f14de043e5d 100644 (file)
@@ -15,6 +15,7 @@ import * as Main from './main.js';
 import * as MessageTray from './messageTray.js';
 import * as SwipeTracker from './swipeTracker.js';
 import {formatDateWithCFormatString} from '../misc/dateUtils.js';
+import {TimeLimitsState} from '../misc/timeLimitsManager.js';
 import * as AuthPrompt from '../gdm/authPrompt.js';
 import {AuthPromptStatus} from '../gdm/authPrompt.js';
 import {MprisSource} from './mpris.js';
@@ -642,6 +643,14 @@ export const UnlockDialog = GObject.registerClass({
 
         this._updateUserSwitchVisibility();
 
+        // When parental controls session limits are enabled, the screen will be
+        // locked upon reaching the time limit. In those cases, tweak the lock screen,
+        // so that the children cannot unlock without parental supervision.
+        Main.timeLimitsManager.connectObject(
+            'notify::state', () => this._updateAuthBlocked(),
+            this);
+        this._updateAuthBlocked();
+
         // Main Box
         const mainBox = new St.Widget();
         mainBox.add_constraint(new Layout.MonitorConstraint({primary: true}));
@@ -757,6 +766,8 @@ export const UnlockDialog = GObject.registerClass({
             this._authPrompt.updateSensitivity(
                 verificationStatus === AuthPromptStatus.NOT_VERIFYING);
         }
+
+        this._updateAuthBlocked();
     }
 
     _maybeDestroyAuthPrompt() {
@@ -914,6 +925,11 @@ export const UnlockDialog = GObject.registerClass({
             !this._lockdownSettings.get_boolean('disable-user-switching');
     }
 
+    _updateAuthBlocked() {
+        this._authPrompt?.setAuthBlocked(
+            Main.timeLimitsManager.state === TimeLimitsState.LIMIT_REACHED);
+    }
+
     cancel() {
         if (this._authPrompt)
             this._authPrompt.cancel();